import request from '/@/utils/request';

export function getUserList(query:Object) {
    return request({
        url: '/api/system/admin/list',
        method: 'get',
        params:query
    })
}

export function getDeptTree() {
    return request({
        url: '/api/system/dept/tree',
        method: 'get'
    })
}

export function getParams() {
    return request({
        url: '/api/system/user/params',
        method: 'get'
    })
}

export function getEditUser(id:number) {
    return request({
        url: '/api/system/admin/detail/'+id,
        method: 'get',
        //params:{id}
    })
}

export function addUser(data:object) {
    return request({
        url: '/api/system/admin/save_admin',
        method: 'post',
        data:data
    })
}


export function updateAdmin(data:object) {
    return request({
        url: '/api/system/admin/update',
        method: 'put',
        data:data
    })
}

export function resetUserPwd(userId:number, password:string) {
    return request({
        url: '/api/system/admin/update_password',
        method: 'put',
        data:{userId,password}
    })
}

export function changeUserStatus(id:number, status:number) {
    return request({
        url: '/api/system/admin/update-status',
        method: 'put',
        data:{id,status}
    })
}


export function deleteUser(ids:number[]) {
    return request({
        url: '/api/system/user/delete',
        method: 'delete',
        data:{ids}
    })
}


